package com.evaluationsystem.config.swaggerConfig;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class SwaggerConfig {

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("考核后台管理系统")
                .termsOfServiceUrl("http://localhost:8080/")
                .description("此API提供接口调用")
                .license("License Version 1.0")
                .version("1.0").build();
    }

    @Bean
    public Docket swaggerSpringMvcPlugin() {
        return new Docket(DocumentationType.SWAGGER_2)
                //api的标题、描述、版本等信息
                .apiInfo(apiInfo())
                //接口模块名称
                .groupName("Gdy")
                // 选择那些路径和api会生成document
                .select()
                //RequestHandlerSelectors 配置要扫描接口的方式
                .apis(RequestHandlerSelectors.basePackage("com.evaluationsystem.system.controller"))
                //过滤 路径
                .paths(PathSelectors.any())
                .build();
    }


}
